<TagAttribute("bitmap", "bitm", "????", "????", 7, 108)>
Public Class BITMAP_TAG
    Inherits HaloTag
    Public Const Extension As String = "bitmap"
    Public Const FourCC As String = "bitm"
    Public Const ParentFourCC As String = "????"
    Public Const GrandParentFourCC As String = "????"
    Public Const [Version] As Short = 7
    Public Const HeaderLength As Integer = 108

    ''' <summary>
    ''' Type controls bitmap 'geometry'. All dimensions must be a power of tw
    ''' </summary>
#Region "type"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("type", 1, 17)>
    Public type_1 As Short

    ''' <summary>
    ''' Format controls how pixels will be stored internally:
    ''' 
    ''' * COMPRESSED WITH COLOR-
    ''' </summary>
#End Region
#Region "format"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("format", 1, 17)>
    Public format_1 As Short

    ''' <summary>
    ''' Usage controls how mipmaps are generated:
    ''' 
    ''' * ALPHA BLEND: Pixels with zero alpha are ignored in mipmaps, to prevent bleeding the transparent color.
    ''' * DEFAULT
    ''' </summary>
#End Region
#Region "usage"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("usage", 1, 17)>
    Public usage_1 As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("flags", 1, 19)>
    Public flags As Short

    ''' <summary>
    ''' These properties control how mipmaps are post-processed.
    ''' </summary>
#End Region
#Region "post-processing"

    ''' <summary>
    ''' 0 means fade to gray by last mipmap, 1 means fade to gray by first mipmap
    ''' </summary>
    <TagField("detail fade factor:[0,1]", 1, 0)>
    Public detail_fade_factor As Single

    ''' <summary>
    ''' sharpens mipmap after downsampling
    ''' </summary>
    <TagField("sharpen amount:[0,1]", 1, 0)>
    Public sharpen_amount As Single

    ''' <summary>
    ''' the apparent height of the bump map above the triangle it is textured onto, in texture repeats (i.e., 1.0 would be as high as the texture is wide)
    ''' </summary>
    <TagField("bump height:repeats", 1, 0)>
    Public bump_height As Single

    ''' <summary>
    ''' When creating a sprite group, specify the number and size of textures that the group is allowed to occupy. During importing, you'll receive feedback about how well the alloted space was used.
    ''' </summary>
#End Region
#Region "sprite processing"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("sprite budget size", 1, 17)>
    Public sprite_budget_size As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("sprite budget count", 1, 23)>
    Public sprite_budget_count As Short

    ''' <summary>
    ''' The original TIFF file used to import the bitmap group.
    ''' </summary>
#End Region
#Region "color plate"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("color plate width:pixels", 1, 23)>
    Public color_plate_width As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("color plate height:pixels", 1, 23)>
    Public color_plate_height As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("compressed color plate data", 1, 31)>
    Public compressed_color_plate_data As New DATA_CONTAINER

    ''' <summary>
    ''' Pixel data after being processed by the tool.
    ''' </summary>
#End Region
#Region "preprocessed pixel data"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("processed pixel data", 1, 31)>
    Public processed_pixel_data As New DATA_CONTAINER

    ''' <summary>
    ''' 
    ''' </summary>
#End Region
#Region "miscellaneous"

    ''' <summary>
    ''' blurs the bitmap before generating mipmaps
    ''' </summary>
    <TagField("blur filter size:[0,10] pixels", 1, 0)>
    Public blur_filter_size As Single

    ''' <summary>
    ''' affects alpha mipmap generation
    ''' </summary>
    <TagField("alpha bias:[-1,1]", 1, 0)>
    Public alpha_bias As Single

    ''' <summary>
    ''' 0 defaults to all levels
    ''' </summary>
    <TagField("mipmap count:levels", 1, 23)>
    Public mipmap_count As Short

    ''' <summary>
    ''' Sprite usage controls the background color of sprite plates.
    ''' </summary>
#End Region
#Region "...more sprite processing"

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("sprite usage", 1, 17)>
    Public sprite_usage As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("sprite spacing", 1, 23)>
    Public sprite_spacing As Short

    ''' <summary>
    ''' 
    ''' </summary>
    <TagField("", 2, -1)>
    Public padding As Byte()

    ''' <summary>
    ''' bitmap_group_sequence_block
    ''' </summary>
    <TagField("sequences", 64, 11)>
    Public sequences As List(Of SEQUENCES_BLOCK)

    ''' <summary>
    ''' bitmap_data_block
    ''' </summary>
    <TagField("bitmaps", 48, 11)>
    Public bitmaps As List(Of BITMAPS_BLOCK)
#End Region
    Public Class SEQUENCES_BLOCK

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("name^", 32, 8)>
        Public name As String

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("first bitmap index", 1, 23)>
        Public first_bitmap_index As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("bitmap count", 1, 23)>
        Public bitmap_count As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 16, -1)>
        Public padding As Byte()

        ''' <summary>
        ''' bitmap_group_sprite_block
        ''' </summary>
        <TagField("sprites", 32, 11)>
        Public sprites As List(Of SPRITES_BLOCK)
        Public Class SPRITES_BLOCK

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("bitmap index", 1, 23)>
            Public bitmap_index As Short

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("", 2, -1)>
            Public padding As Byte()

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("", 4, -1)>
            Public padding_1 As Byte()

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("left", 1, 0)>
            Public left As Single

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("right", 1, 0)>
            Public right As Single

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("top", 1, 0)>
            Public top As Single

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("bottom", 1, 0)>
            Public bottom As Single

            ''' <summary>
            ''' 
            ''' </summary>
            <TagField("registration point", 2, 1)>
            Public registration_point As Single()

        End Class

    End Class
    Public Class BITMAPS_BLOCK

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("signature", 1, 4)>
        Public signature As Integer

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("width", 1, 23)>
        Public width As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("height", 1, 23)>
        Public height As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("depth", 1, 23)>
        Public depth As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("type", 1, 17)>
        Public type As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("format", 1, 17)>
        Public format As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("flags*", 1, 19)>
        Public flags As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("registration point", 2, 24)>
        Public registration_point As Short()

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("mipmap count", 1, 23)>
        Public mipmap_count As Short

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 2, -1)>
        Public padding As Byte()

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 2, 15)>
        Public unknown As Integer()

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 1, 27)>
        Public unknown_1 As Integer

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 4, -1)>
        Public padding_1 As Byte()

        ''' <summary>
        ''' 
        ''' </summary>
        <TagField("", 8, -1)>
        Public padding_2 As Byte()

    End Class

End Class
